package com.hon.legionnaire.negocio.vo;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

@Entity
@Table(name = "servicoOrdemServico")
@NamedQueries ({
	@NamedQuery(name = "loadAllServicoOrdemServico", query = "from ServicoOrdemServicoVO as pc where pc.ordemServicoVO.codigo = :codigo"),
})
public class ServicoOrdemServicoVO implements Serializable {

	private static final long serialVersionUID = 1L;

	@EmbeddedId  
	private ServicoOrdemServicoPK servicoOrdemServicoPK;
	
	@Column(name = "preco_servico")
	Float precoServico;
	
	@JoinColumn(name="cod_ordem_servico", 
			referencedColumnName="cod_ordem_servico",
			nullable = false,
			insertable=false, updatable=false)
	@ManyToOne(optional=false, fetch= FetchType.LAZY)
	@Basic(optional=false)
	@Fetch(FetchMode.JOIN)
	private OrdemServicoVO ordemServicoVO;
	
	@JoinColumn(name="cod_servico", 
			referencedColumnName="cod_servico",
			nullable = false,
			insertable=false, updatable=false)
	@ManyToOne(optional=false, fetch= FetchType.LAZY)
	@Basic(optional=false)
	@Fetch(FetchMode.JOIN)
	private ServicoVO servicoVO;
		
	public ServicoOrdemServicoVO(){
		servicoOrdemServicoPK = new ServicoOrdemServicoPK();
	}
	
	public ServicoOrdemServicoPK getServicoOrdemServicoPK() {
		return servicoOrdemServicoPK;
	}

	public void setServicoOrdemServicoPK(ServicoOrdemServicoPK servicoOrdemServicoPK) {
		this.servicoOrdemServicoPK = servicoOrdemServicoPK;
	}

	public OrdemServicoVO getOrdemServicoVO() {
		return ordemServicoVO;
	}

	public void setOrdemServicoVO(OrdemServicoVO ordemServicoVO) {
		this.ordemServicoVO = ordemServicoVO;
	}

	public ServicoVO getServicoVO() {
		return servicoVO;
	}

	public void setServicoVO(ServicoVO servicoVO) {
		this.servicoVO = servicoVO;
	}

	public Float getPrecoServico() {
		return precoServico;
	}

	public void setPrecoServico(Float precoServico) {
		this.precoServico = precoServico;
	}

}